<%@page import="com.hzqy.commons.utils.ConstantUtils"%>
<%@ page contentType="text/html; charset=UTF-8" language="java"%>
<%@page import="com.hzqy.web.vo.PmsUserVo"%>
<%@ taglib prefix="limits" uri="/WEB-INF/tld/limits.tld"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%
PmsUserVo puv = (PmsUserVo) session.getAttribute(ConstantUtils.SESSION_USER);
String roleIds=puv.getRoleIds();
String[] ids = roleIds.split(",");
for(int i=0 ;i<ids.length ; i++){
	if("1".equals(ids[i])){
		roleIds="1";
		break;
	}
}
String []nonceObj=ConstantUtils.getNonceObject();
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>zTree</title>
<link rel="stylesheet" type="text/css"
	href="../static/js/themes/defalut.css">
<link rel="stylesheet" type="text/css"
	href="../static/js/themes/public.css">
<link rel="stylesheet" type="text/css"
	href="../static/js/themes/ddspstyle.css">
<link rel="stylesheet" type="text/css"
	href="../static/js/themes/default/easyui.css">
<link rel="stylesheet" type="text/css"
	href="../static/js/themes/icon.css">
<script type="text/javascript" src="../static/js/jquery.min.js"></script>
<script type="text/javascript" src="../static/js/jquery.easyui.min.js"></script>
<script type="text/javascript"
	src="../static/js/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="../static/js/jquery.validate.js"></script>
<script type="text/javascript" src="../static/js/index.js"></script>
<link rel="stylesheet" type="text/css"
	href="../static/zTree/css/zTree.css">
<link rel="stylesheet" type="text/css"
	href="../static/zTree/css/zTreeStyle/zTreeStyle.css">
<link rel="stylesheet" type="text/css"
	href="../static/js/themes/default/easyui.css">
<script type="text/javascript"
	src="../static/zTree/js/jquery.ztree.core.js"></script>
<script type="text/javascript"
	src="../static/zTree/js/jquery.ztree.excheck.js"></script>
<script type="text/javascript"
	src="../static/zTree/js/jquery.ztree.exedit.js"></script>
<script type="text/javascript">
var roleIds = "<%=roleIds%>";
var isAdd = true;
var org_name = '<spring:message code="org_name"/>';
var setting = {
		view: {
			addHoverDom: addHoverDom,
			removeHoverDom: removeHoverDom,
			selectedMulti: false
		},
		edit: {
			enable: true,
			editNameSelectAll: true,
			showRemoveBtn: false,
			showRenameBtn: false
		},
		data: {
			simpleData: {
				enable: true
			}
		},
		callback: {
			beforeDrag: beforeDrag,
			onClick:zTreeOnClick
		}
	};
	//禁止拖拽
	function beforeDrag(treeId, treeNodes) {
		return false;
	}
	//点击事件
	function zTreeOnClick(event,treeId,treeNode){
		window.rightFrame.location.href = "org_management.jsp?f_po_id="+treeNode.id;
		$("#mgc_iframe").show();
		$("#right").hide();
	}
	function nodeRemove(treeId, treeNode) {
		$.messager.confirm("操作提示","您确定要删除"+treeNode.name+" 吗？",function(sure){
			if(sure) {
				$.ajax({
					url:"org_del.do?f_po_id="+treeNode.id+"&stime=<%=nonceObj[0]%>&sign=<%=nonceObj[1]%>",
					success:function(data) {
						data = JSON.parse(data);
						if(data.success){
							$.messager.alert("操作提示","删除成功!","info",function(){
								window.location.reload();
							});
						} else {
							$.messager.alert("操作提示","删除失败!","error");
						}
						window.location.reload();
					}
				});
			}
		});
		return false;
	}
	function addHoverDom(treeId, treeNode) {
		if(!treeNode.isParent) {
			var sObj3 = $("#" + treeNode.tId + "_span");
			if (treeNode.editNameFlag || $("#bindBtn_"+treeNode.tId).length>0) return;
			var bindStr = "<limits:uiAuth url='label_bind.jsp'><span class='button bind' id='bindBtn_" + treeNode.tId
				+ "' title='bind node' onfocus='this.blur();'></span></limits:uiAuth>";
			sObj3.after(bindStr);
			var btn = $("#bindBtn_"+treeNode.tId);
			if (btn) btn.bind("click", function(event){
				nodeBind(treeNode.id);
				event.stopPropagation();
			});
			
			var sObj2 = $("#" + treeNode.tId + "_span");
			if (treeNode.editNameFlag || $("#removeBtn_"+treeNode.tId).length>0) return;
			var removeStr = "<limits:uiAuth url='org_del.do'><span class='button remove' id='removeBtn_" + treeNode.tId
				+ "' title='remove node' onfocus='this.blur();'></span></limits:uiAuth>";
			sObj2.after(removeStr);
			var btn = $("#removeBtn_"+treeNode.tId);
			if (btn) btn.bind("click", function(event){
				nodeRemove(treeId, treeNode);
				event.stopPropagation();
			});
		}
		if(roleIds != "1" && treeNode.id == "0"){//非管理员，在第一个节点无添加和修改权限
		
		}else{
			var sObj1 = $("#" + treeNode.tId + "_span");
			if (treeNode.editNameFlag || $("#editBtn_"+treeNode.tId).length>0) return;
			var editStr = "<limits:uiAuth url='org_update.do'><span class='button edit' id='editBtn_" + treeNode.tId
				+ "' title='edit node' onfocus='this.blur();'></span></limits:uiAuth>";
			sObj1.after(editStr);
			var btn = $("#editBtn_"+treeNode.tId);
			if (btn) btn.bind("click", function(event){
				editInit(treeNode);
				event.stopPropagation();
			});
			
			var sObj = $("#" + treeNode.tId + "_span");
			if (treeNode.editNameFlag || $("#addBtn_"+treeNode.tId).length>0) return;
			var addStr = "<limits:uiAuth url='org_add.do'><span class='button add' id='addBtn_" + treeNode.tId
				+ "' title='add node' onfocus='this.blur();'></span></limits:uiAuth>";
			sObj.after(addStr);
			var btn = $("#addBtn_"+treeNode.tId);
			if (btn) btn.bind("click", function(event){
				addInit(treeNode);
				event.stopPropagation();
			});
			
		}
	};
	function removeHoverDom(treeId, treeNode) {
		$("#addBtn_"+treeNode.tId).unbind().remove();
		$("#editBtn_"+treeNode.tId).unbind().remove();
		$("#removeBtn_"+treeNode.tId).unbind().remove();
		$("#bindBtn_"+treeNode.tId).unbind().remove();
	};
	function selectAll() {
		var zTree = $.fn.zTree.getZTreeObj("ztree");
		zTree.setting.edit.editNameSelectAll =  $("#selectAll").attr("checked");
	}
	
	$(document).ready(function(){
		$("#right").hide();
		$.ajax({
			url:"org_list.do?f_po_id=0",
			success:function(data){
				zNodes = JSON.parse(data);
				var root = {id:"0",name:org_name+'设置',open:false};
				zNodes.push(root);
				var treeObj = $.fn.zTree.init($("#ztree"), setting, zNodes);
				$("#selectAll").bind("click", selectAll);
				updateNoParentNode(treeObj);
			}
		});
	});
	
	function updateNoParentNode(treeObj){
		var nodesArr = treeObj.transformToArray(treeObj.getNodes());
		for(var i=0;i<nodesArr.length;i++){
			var rootNode = null;
			if(nodesArr[i].pId == null && nodesArr[i].id == '0'){
				rootNode = nodesArr[i];
				break;
			}
		}
		for(var i=0;i<nodesArr.length;i++){
			if(nodesArr[i].pId == null && nodesArr[i].id != '0'){
				treeObj.moveNode(treeObj.moveNode(rootNode, nodesArr[i], "inner"));
			}
		}
	}
	
	
	$(function(){
		$("#contentForm").validate({
			rules: {
				f_po_name: {
					required: true,
					minlength: 3,
					maxlength: 50
				},
				f_po_price: {
					required: true,
					digits:true
				},
				user_count: {
					digits:true
				},
				city: {
					required: true,
				},
				f_po_email:{
					/* required:false,
					email: true */
					required:false
				},
				f_po_location_score:{
					min:0,
					max:5
				},
				f_po_facility_score:{
					min:0,
					max:5
				},
				f_po_service_score:{
					min:0,
					max:5
				},
				f_po_health_score:{
					min:0,
					max:5
				},
				f_po_lon:{
					required: true,
					number:true
				},
				f_po_lat:{
					required: true,
					number:true
				},
				f_po_pb_model_time:{
					required: true,
					digits:true
				},
			},
			messages: {
				f_po_name: {
					required: "请输入" + org_name +"名称",
					minlength: org_name+"名称不能少于3位",
					maxlength: org_name+"名称不能超过50位"
				},
				f_po_price: {
					required: "请输入价格",
					digits:"价格只能是数字"
				},
				f_po_pb_model_time: {
					required: "请输入时间",
					digits:"只能是数字"
				},
				user_count: {
					digits:"账号数量只能是数字"
				},
				city: {
					required: "请选择城市",
				},
				//f_po_email: "请输入有效的Email地址"
				f_po_email: '<spring:message code="org_email_error_msg"/>',
				f_po_location_score: {
					min: "请输入0至5之间的数",
					max: "请输入0至5之间的数"
				},
				f_po_facility_score: {
					min: "请输入0至5之间的数",
					max: "请输入0至5之间的数"
				},
				f_po_service_score: {
					min: "请输入0至5之间的数",
					max: "请输入0至5之间的数"
				},
				f_po_health_score: {
					min: "请输入0至5之间的数",
					max: "请输入0至5之间的数"
				},
				f_po_lon: {
					required: "请输入坐标",
					number:"请输入数字"
				},
				f_po_lat: {
					required: "请输入坐标",
					number:"请输入数字"
				},
			},
			
		});
	});
	
	function move(obj){
	    if(obj=='')
	    {
	        return;
	    }
	    var leftUser=document.getElementById("leftUser");
	    var rightUser=document.getElementById("rightUser");
		var leftRole=document.getElementById("leftRole");
	    var rightRole=document.getElementById("rightRole");
	    var arrOptions=new Array;
	    if(obj=="add1"){
	        for(var i=0;i<leftUser.options.length;i++)
	        {
	            if(leftUser.options[i].selected)
	            {
	                //将当前选中的添加到数组中
	                arrOptions.push(leftUser.options[i]);
	            }
	        }
	        for(var i=0;i<arrOptions.length;i++)
	        {
	            //循环把数组中的值添加的rightUser
	            rightUser.appendChild(arrOptions[i]);
	        }
	    }
	    else if(obj=="delete1"){
	        for(var i=0;i<rightUser.options.length;i++)
	        {
	            if(rightUser.options[i].selected)
	            {
	                arrOptions.push(rightUser.options[i]);
	            }
	        }
	        for(var i=0;i<arrOptions.length;i++)
	        {
	            leftUser.appendChild(arrOptions[i]);
	        }
	    }
		if(obj=="add2"){
	        for(var i=0;i<leftRole.options.length;i++)
	        {
	            if(leftRole.options[i].selected)
	            {
	                arrOptions.push(leftRole.options[i]);
	            }
	        }
	        for(var i=0;i<arrOptions.length;i++)
	        {
	            rightRole.appendChild(arrOptions[i]);
	        }
	    }
	    else if(obj=="delete2"){
	        for(var i=0;i<rightRole.options.length;i++)
	        {
	            if(rightRole.options[i].selected)
	            {
	                arrOptions.push(rightRole.options[i]);
	            }
	        }
	        for(var i=0;i<arrOptions.length;i++)
	        {
	            leftRole.appendChild(arrOptions[i]);
	        }
	    }
	}
	function getLeftUserList(f_po_id) {
		$("#leftUser").empty();
		$.ajax({
			url:"orgUser_select.do?f_po_id="+f_po_id,
			success:function(data) {
				data = JSON.parse(data);
				var str="";
				for(var i=0;i<data.length;i++) {
					str+='<option value="'+data[i].f_pu_id+'">'+data[i].f_pu_name+'</option>';
				}
				$("#leftUser").append(str);
			}
		});
	}
	function getRightUserList() {
		$.ajax({
			url:"orgUser_list.do",
			success:function(data) {
				data = JSON.parse(data);
				var str="";
				for(var i=0;i<data.length;i++) {
					str+='<option value="'+data[i].f_pu_id+'">'+data[i].f_pu_name+'</option>';
				}
				$("#rightUser").append(str);
			}
		});
	}
	function getOrgRole(f_po_id) {
		$.ajax({
			url:"orgRole_select.do?f_po_id="+f_po_id,
			success:function(data) {
			
			}
		});
	}
	function getAddress(){
		var prov = $("#prov").val();
		var city = $("#city").val();
		var country = $("#country").val();
		return prov+"-"+city+"-"+country;
	}
	
	function _submitFm() {
		var userList="";
		$("#leftUser option").each(function(){
			userList+=$(this).val()+",";
		});
		$("#userListValue").val(userList);
		var roleList="";
		$("#leftRole option").each(function(){
			roleList+=$(this).val()+",";
		});
		$("#roleListValue").val(roleList);
		$("#f_po_address").val(getAddress());
		//console.log($("#contentForm").serialize());
		 if($("#contentForm").validate().form()) {
			if(isAdd){
				app_ajax('org_add.do', $("#contentForm").serialize(), function(data){
					if(data.success) {
						$.messager.progress('close');
						$.messager.alert('提示', '提交成功！', 'info', function() {
							parent.$('#dlg').dialog('close');
							//window.location.reload();
						});
					} else {
						console.log("失败"+data);
						$.messager.alert('提示', data.result, 'info', function() {
							$.messager.progress('close');
						});
					}
				});
			} else {
				app_ajax('org_update.do', $("#contentForm").serialize(), function(data){
					if(data.success) {
						$.messager.progress('close');
						$.messager.alert('提示', '提交成功！', 'info', function() {
							parent.$('#dlg').dialog('close');
							//window.location.reload();
						});
					} else {
						$.messager.alert('提示', data.result, 'info', function() {
							$.messager.progress('close');
						});
					}
				});
			}
			
		 }
	}
	function addInit(treeNode) {
		isAdd = true;
		$("#cancelButton").show();
		$("#authorizeButton").hide();
		$("#rightRole").empty();
		$("#leftRole").empty();
		$("#rightUser").empty();
		$("#leftUser").empty();
		getRightUserList();
		$.ajax({
			url:"orgRole_list.do",
			success:function(data) {
				data = JSON.parse(data);
				var str="";
				for(var i=0;i<data.length;i++) {
					str+='<option value="'+data[i].f_prole_id+'">'+data[i].f_prole_name+'</option>';
				}
				$("#rightRole").append(str);
			}
		});
		$("legend").html(org_name+"新增");
		$("#parentName").html(treeNode.name);
		$("#f_po_parentId").val(treeNode.id);
		$("#f_po_id").val(0);
		$("#f_po_code").val("");
		$("#f_po_name").val("");
		$("#f_po_english").val("");
		$("#f_po_desc").val("");
		$("#f_po_address").val("");
		$("#f_po_address_detail").val("");
		$("#f_po_email").val("");
		$('input:checkbox[name=f_po_type]:checked').prop("checked", false);
		$("#f_po_model").val(0);
		$("#f_po_model_name").val("");
		$("#f_po_status").val(1);
		$("#f_po_stars").val("");
		$("#f_po_platform_type").val(0);
		$("#f_po_price").val(0);
		$("#f_po_pb_model_time").val(0);
		$("#user_count").val(0);
		$("#f_po_location_score").val(0);
		$("#f_po_facility_score").val(0);
		$("#f_po_service_score").val(0);
		$("#f_po_health_score").val(0);
		$("#f_po_lon").val(0);
		$("#f_po_lat").val(0);
		$("#f_po_show_region").val("");
		$("#f_cc_productid").val("");
		$("#f_cc_productname").val("");
		$("#f_po_voiceSwitch").val("1");
		$("#prov").val(11);
		$("#city").val("");
		$("#country").val("");
		$("#right").show();
		$("#mgc_iframe").hide();
		$("#f_po_dsf_gg_model").val(1);
		$("#f_po_hotelcontract").val("");

	}
	function editInit(treeNode) {
		$("#cancelButton").hide();
		$("#authorizeButton").show();
		$("#rightUser").empty();
		isAdd = false;
		$("legend").html(org_name+"设置");
		$.ajax({
			url:"org_select.do?f_po_id="+treeNode.id,
			success:function(data){
				$("#parent").hide();
				data=JSON.parse(data);
				$("#f_po_id").val(data.f_po_id);
				$("#f_po_code").val(data.f_po_code);
				$("#f_po_name").val(data.f_po_name);
				$("#f_po_english").val(data.f_po_english);
				$("#f_po_parentId").val(data.f_po_parentId);
				$("#f_po_desc").val(data.f_po_desc);
				$("#f_po_address").val(data.f_po_address);
				$("#f_po_address_detail").val(data.f_po_address_detail);
				$("#f_po_email").val(data.f_po_email);
				$("#f_po_type").val(data.f_po_type);
				$("#f_po_stars").val(data.f_po_stars);
				$("#f_po_platform_type").val(data.f_po_platform_type);
				$("#f_po_join_divide").val(data.f_po_join_divide);
				$("#f_po_weatherType").val(data.f_po_weatherType);
				$("#f_po_pb_model").val(data.f_po_pb_model);
				$("#f_po_open_model").val(data.f_po_open_model);
				$("#f_po_advertise_switch").val(data.f_po_advertise_switch);
				$("#f_po_alert").val(data.f_po_alert);
				$("#f_po_price").val(data.f_po_price);
				$("#user_count").val(data.user_count);
				$("#f_po_location_score").val(data.f_po_location_score);
				$("#f_po_facility_score").val(data.f_po_facility_score);
				$("#f_po_service_score").val(data.f_po_service_score);
				$("#f_po_health_score").val(data.f_po_health_score);
				$("#f_po_lon").val(data.f_po_lon);
				$("#f_po_lat").val(data.f_po_lat);
				$("#f_po_show_region").val(data.f_po_show_region);
				$("#f_po_category").val(data.f_po_category);
				$("#f_po_voiceSwitch").val(data.f_po_voiceSwitch);
				$("#f_po_pb_model_time").val(data.f_po_pb_model_time);
				$("#f_po_dsf_gg_model").val(data.f_po_dsf_gg_model);
				$("#f_po_hotelcontract").val(data.f_po_hotelcontract);

				if(data.f_po_address){
					var areaArr = data.f_po_address.split("-");
					$("#prov").val(11);
					$("#city").val(areaArr[1]);
					showCountry(city);
					$("#country").val(areaArr[2]);
				}else{
					$("#prov").val(11);
					$("#city").val("");
					$("#country").val("");
				}
				if(data.f_po_type){
					var arr=data.f_po_type.split(",");
					$('input:checkbox[name=f_po_type]:checked').prop("checked", false);
					if(arr.length>0){
						for(var i=0;i<arr.length;i++){
							if(arr[i]=="1"){
								$("#org_type_1").prop("checked", true);
							}else if(arr[i]=="2"){
								$("#org_type_2").prop("checked", true);
							}else if(arr[i]=="3"){
								$("#org_type_3").prop("checked", true);
							}
						}
					}
				}
				$("#f_po_model").val(data.f_po_model);
				$("#f_po_model_name").val(data.f_po_model_name);
				$("#f_po_status").val(data.f_po_status);

				$("#f_cc_productname").val(data.f_cc_productname);
				$("#f_cc_productid").val(data.f_cc_productid);

				$("#right").show();
				$("#mgc_iframe").hide();
			}
		});
		<%if(((PmsUserVo)session.getAttribute(ConstantUtils.SESSION_USER)).getOrgId()==1){ %>
			getRightUserList();
		<%}%>
		getLeftUserList(treeNode.id);
		$("#rightRole").empty();
		$("#leftRole").empty();
		var leftStr="";
		var rightStr="";
		$.ajax({
			url:"orgRole_list.do",
			success:function(data) {
				data = JSON.parse(data);
				$.ajax({
					url:"orgRole_select.do?f_po_id="+treeNode.id,
					success:function(roleData) {
						roleData = JSON.parse(roleData);
						for(var i=0;i<data.length;i++) {
							var roleIsExist = false;
							for(var j=0;j<roleData.length;j++) {
								if(data[i].f_prole_id == roleData[j].f_por_roleId){
									roleIsExist = true;
								}
							}
							if(roleIsExist)
								leftStr+='<option value="'+data[i].f_prole_id+'">'+data[i].f_prole_name+'</option>';
							else
								rightStr+='<option value="'+data[i].f_prole_id+'">'+data[i].f_prole_name+'</option>';
						}
						$("#leftRole").append(leftStr);
						$("#rightRole").append(rightStr);
					}
				});
			}
		});
	}
	function nodeBind(treeId){
		openDialog($('#label'),'label_bind.jsp?f_po_id='+treeId);
	}
	
	function authorize(){
		var f_po_id = $("#f_po_id").val();
		openDialog($('#dlg'),'user_role.jsp?f_po_id='+f_po_id);
	}
	function modelSelect(){
		openDialog($('#model_list'),'model_update.jsp');
	}
	function bind(id) {
		openDialog($('#model_list'),'model_update.jsp');
	}
	function bindProduct() {
		openDialog($('#dlg_product'),'../content/product_bind.jsp?chooseid='+$("#f_cc_productid").val());
	}

	function resert(){
		$("#f_cc_productname").val("");
		$("#f_cc_productid").val("");
	}

</script>
</head>
<body style="background: #FFFFFF;">
	<div id="left"
		style="width: 25%; overflow: auto; float: left; background: #d2e0f2;">
		<ul id="ztree" class="ztree"></ul>
	</div>
	<div id="mgc_iframe" style="height:700px;width: 75%;overflow: auto; float: right;">
		<iframe name="rightFrame" style="width:100%;height:100%;" frameborder="0" ></iframe>
	</div>
	<div id="right" style="width: 75%; overflow: auto; float: right;">
		<!-- <div class="barnavtop">您所在的位置：资源管理 &gt; 资源新增</div> -->
		<div id="container">
			<div class="editspace">
				<form id="contentForm" class="cmxform" enctype="multipart/form-data"
					name="formName">
					<input type="hidden" id="f_po_parentId" name="f_po_parentId"
						value="" /> <input type="hidden" id="f_po_id" name="f_po_id"
						value="" /> <input type="hidden" id="userListValue"
						name="userListValue" value="" /> <input type="hidden"
						id="roleListValue" name="roleListValue" value="" />
					<input type="hidden" id="f_po_address" name="f_po_address" value="" />
					<input type="hidden" id="flag" name="flag" value="industry"/>
					<legend><spring:message code="org_name"/>新增</legend>
					<fieldset id="parent">
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="30%" align="right">上级目录：</td>
									<td id="parentName" width="70%"></td>
								</tr>
							</table>
						</div>
					</fieldset>
					
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="30%" align="right"><span class="red">*</span><spring:message code="org_name"/>名称：</td>
									<td width="70%"><input id="f_po_name" type="text"
										name="f_po_name" value="ddd" /><font style="color: red"><spring:message code="org_name_alert"/></font></td>
								</tr>
							</table>
						</div>
					</fieldset>
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="30%" align="right"><spring:message code="org_name"/>英文名称：</td>
									<td width="70%"><input id="f_po_english" type="text"
										name="f_po_english"/></td>
								</tr>
							</table>
						</div>
					</fieldset>
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="30%" align="right"><spring:message code="org_email_title"/>：</td>
									<td width="70%"><input name="f_po_email" id="f_po_email"
										style="width: 150px;" value="" class="yl_inp yw_name" /> <span
										id="f_po_email_tip" class="tip"></span></td>
								</tr>
							</table>
						</div>
					</fieldset>
					
					<fieldset class="hide-field">
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="30%" align="right"><spring:message code="org_name"/>编号：</td>
									<td width="70%"><input id="f_po_code" type="text"
										name="f_po_code" value="0000" /></td>
								</tr>
							</table>
						</div>
					</fieldset>

					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="30%" align="right"><spring:message code="org_name"/>标语：</td>
									<td width="70%">
										<input id="f_po_desc" type="text" name="f_po_desc" value="" /></td>
								</tr>
							</table>
						</div>
					</fieldset>

                    <fieldset style="display:block;">
                        <div class="fitem">
                            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td width="30%" align="right">参与分成：</td>
                                    <td width="70%"><select name="f_po_join_divide"
                                                            id="f_po_join_divide" style="width: 150px;">
                                        <option value="1">是</option>
                                        <option value="2" selected="selected">否</option>
                                    </select></td>
                                </tr>
                            </table>
                        </div>
                    </fieldset>

                    <fieldset style="display:block;">
                        <div class="fitem">
                            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td width="30%" align="right">天气显示类型：</td>
                                    <td width="70%"><select name="f_po_weatherType"
                                                            id="f_po_weatherType" style="width: 150px;">
                                        <option value="1" selected="selected">市天气</option>
                                        <option value="2">区县天气</option>
                                    </select></td>
                                </tr>
                            </table>
                        </div>
                    </fieldset>

                    <fieldset style="display:block;">
                        <div class="fitem">
                            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td width="30%" align="right">开机视频图片显示：</td>
                                    <td width="70%"><select name="f_po_open_model"
                                                            id="f_po_open_model" style="width: 150px;">
                                        <option value="1" >显示一次</option>
                                        <option value="2" selected="selected">每次按首页显示</option>
                                    </select></td>
                                </tr>
                            </table>
                        </div>
                    </fieldset>

                    <fieldset style="display:block;">
                        <div class="fitem">
                            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td width="30%" align="right">屏保模式：</td>
                                    <td width="30%"><select name="f_po_pb_model"
                                                            id="f_po_pb_model" style="width: 150px;">
                                        <option value="1" selected="selected">显示省公司内容</option>
                                        <option value="2">不显示省公司内容</option>
                                    </select></td>

									<td width="12%" align="right">屏保时间:(单位:s)：</td>
									<td width="28%"><input id="f_po_pb_model_time" type="text"
														   name="f_po_pb_model_time" value="0" /></td>
									</td>
                                </tr>
                            </table>
                        </div>
                    </fieldset>

					<fieldset style="display:block;">
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="30%" align="right">广告开关：</td>
									<td width="30%"><select name="f_po_advertise_switch"
															id="f_po_advertise_switch" style="width: 150px;">
										<option value="1" selected="selected">显示广告</option>
										<option value="2">不显示广告</option>
									</select>
									</td>

									<td width="12%" align="right">声音开关：</td>
									<td width="28%">
										<select name="f_po_voiceSwitch"
															id="f_po_voiceSwitch" style="width: 150px;">
										<option value="1" selected="selected">开启声音</option>
										<option value="2">关闭声音</option>
									</select>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>

					<fieldset style="display:block;">
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="30%" align="right">弹框开关：</td>
									<td width="70%"><select name="f_po_alert"
															id="f_po_alert" style="width: 150px;">
										<option value="1">开</option>
										<option value="2" selected="selected">关</option>
									</select></td>
								</tr>
							</table>
						</div>
					</fieldset>

					<fieldset style="display:block;">
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="30%" align="right">页面展示策略：</td>
									<td width="70%"><select name="f_po_show_region"
															id="f_po_show_region" style="width: 150px;">
										<option value="">展示默认地市</option>
										<option value="gd">展示广电内容</option>
										<option value="bst">展示百视通内容</option>
									</select></td>
								</tr>
							</table>
						</div>
					</fieldset>

					<fieldset style="display:block;">
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="30%" align="right">展示内容类别：</td>
									<td width="70%"><select name="f_po_category"
															id="f_po_category" style="width: 150px;">
                                        <option value="a">餐饮饭店</option>
										<option value="b">个人类（规模<10个机顶盒数）</option>
										<option value="c">个人类（规模≥10个机顶盒数）</option>
										<option value="d">公寓及宿舍类</option>
										<option value="e" selected="selected">酒店类</option>
										<option value="f">旅行社</option>
										<option value="g">企业公司</option>
										<option value="h">学校</option>
										<option value="i">养老院</option>
										<option value="j">医院</option>
										<option value="k">政府单位</option>
										<option value="l">足浴休闲类</option>
									</select></td>
								</tr>
							</table>
						</div>
					</fieldset>

					<fieldset class="hide-field">
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="30%" align="right"><span class="red">*</span> 价格（单位：分）：</td>
									<td width="70%"><input id="f_po_price" type="text"
										name="f_po_price" value="0" /></td>
								</tr>
							</table>
						</div>
					</fieldset>

					<fieldset class="hide-field">
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="30%" align="right">星级：</td>
									<td width="70%"><input id="f_po_stars" type="text"
										name="f_po_stars" value="" /></td>
								</tr>
							</table>
						</div>
					</fieldset>
					
					<fieldset class="hide-field">
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="30%" align="right">保洁次数：</td>
									<td width="70%"><input id="f_po_platform_type" type="text"
										name="f_po_platform_type" value="0" onblur="residueCount()"/>
										</td>
								</tr>
								
							</table>
						</div>
					</fieldset>
					
					<fieldset class="hide-field">
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="30%" align="right"><spring:message code="org_name"/>账号数量：</td>
									<td width="70%"><input id="user_count" type="text"
										name="user_count" value="0" /></td>
								</tr>
							</table>
						</div>
					</fieldset>
					
					<fieldset class="hide-field">
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="30%" align="right"><spring:message code="org_name"/>位置点评：</td>
									<td width="30%"><input id="f_po_location_score" type="text"
										name="f_po_location_score" value="0" /></td>
										
									<td width="12%" align="right"><spring:message code="org_name"/>设施点评：</td>
									<td width="28%"><input id="f_po_facility_score" type="text"
										name="f_po_facility_score" value="0" /></td>
								</tr>
							</table>
						</div>
					</fieldset>
					
					<fieldset class="hide-field">
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="30%" align="right"><spring:message code="org_name"/>服务点评：</td>
									<td width="30%"><input id="f_po_service_score" type="text"
										name="f_po_service_score" value="0" /></td>
										
									<td width="12%" align="right"><spring:message code="org_name"/>卫生点评：</td>
									<td width="28%"><input id="f_po_health_score" type="text"
										name="f_po_health_score" value="0" /></td>
								</tr>
							</table>
						</div>
					</fieldset>
					
					<fieldset class="hide-field">
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="30%" align="right">坐标纬度：</td>
									<td width="30%"><input id="f_po_lat" type="text"
										name="f_po_lat" value="0" /></td>
									<td width="12%" align="right">坐标经度：</td>
									<td width="28%"><input id="f_po_lon" type="text"
										name="f_po_lon" value="0" /></td>
								</tr>
							</table>
						</div>
					</fieldset>

					<fieldset class="hide-field">
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="30%" align="right">是否获取第三方广告：</td>
									<td width="30%"><select name="f_po_dsf_gg_model"
															id="f_po_dsf_gg_model" style="width: 150px;">
										<option value="1">否</option>
										<option value="2">是</option>
									</select></td>
									<td width="12%" align="right">酒店合同号：</td>
									<td width="28%"><input id="f_po_hotelcontract" type="text"
														   name="f_po_hotelcontract" value="" /></td>
								</tr>
							</table>
						</div>
					</fieldset>
					
					<fieldset class="hide-field">
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td align="right" width="25%">省份：</td>
									<td align="left" width="10%">
				            			<select id="prov" onfocus="this.defaultIndex=this.selectedIndedx;" onchange="this.selectedIndex=this.defaultIndex;" style="width: 120px;">
							                <option value="11">浙江省</option>
							            </select>
									</td>
									<td align="right" width="6%">城市：</td>
									<td align="left" width="12%">
										<select id="city" name="city" onchange="showCountry(this)" style="width: 120px;">
											<option value="">请选择</option>
										</select>
									</td>
									<td align="right" width="6%">区县：</td>
									<td align="left" width="12%">
										<select id="country" style="width: 120px;">
											<option value="">请选择</option>
										</select>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="30%" align="right"><spring:message code="org_name"/>详细地址：</td>
									<td width="70%"><input id="f_po_address_detail" type="text"
										name="f_po_address_detail" style="width: 450px;" value="" class="yl_inp yw_name"/></td>
								</tr>
							</table>
						</div>
					</fieldset>

					<fieldset class="hide-field">
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="15%" align="right">
										产品选择:
									</td>
									<td width="30%">
										<input name="f_cc_productname" id="f_cc_productname" readonly="readonly"	style="width: 300px;" value="" class="yl_inp yw_name" />
										<input name="f_cc_productid" id="f_cc_productid" type="hidden" value="" />
										<input name="status" id="status" type="hidden" value="nochange" />
										<a  class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0);"
										   onclick="bindProduct();">选择</a>
										<a  class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0);" onclick="resert()">清空</a>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>

					<fieldset class="hide-field">
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="30%" align="right"><spring:message code="org_name"/>类型：</td>
									<td width="70%">
									<input type="checkbox" id="org_type_1" name="f_po_type" value="1"/>小学
									<input type="checkbox" id="org_type_2" name="f_po_type" value="2"/>中学
									<input type="checkbox" id="org_type_3" name="f_po_type" value="3"/>高中
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="30%" align="right"><spring:message code="org_name"/>模板：</td>
									<td width="20%">
									<input name="f_po_model_name" id="f_po_model_name" readonly="readonly"	style="width: 150px;" value="" class="yl_inp yw_name" />
									<span id="f_po_model_name_tip" class="tip"></span></td>
									<td width="50%">
									<input type="hidden" id="f_po_model" name="f_po_model"  value="00"/>
									<a  class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0);"
											onclick="modelSelect()">选择</a></td>
								</tr>
							</table>
						</div>
					</fieldset>
					<fieldset style="display:block;">
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="30%" align="right"><spring:message code="org_name"/>状态：</td>
									<td width="70%"><select name="f_po_status"
										id="f_po_status" style="width: 150px;">
											<option value="1" selected="selected">有效</option>
											<option value="2">审核中</option>
											<option value="4">审核未通过</option>
											<option value="5">待处理</option>
											<option value="6">不通过</option>
									</select></td>
								</tr>
							</table>
						</div>
					</fieldset>

					<fieldset class="hide-field">
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="30%" align="right"><spring:message code="org_name"/>成员：</td>
									<td><select id="leftUser" size="5" style="width: 150px;"></select>
									</td>
									<%if(((PmsUserVo)session.getAttribute(ConstantUtils.SESSION_USER)).getOrgId()==1){ %>
									<td><input type="button" value=">>" onclick="move('add1')" /><br />
										<input type="button" style="margin-bottom: 10px;"
										value="<<" onclick=" move('delete1')"/></td>
									<td><select id="rightUser" size="5" style="width: 150px;"></select>
									</td>
									<%} %>
								</tr>
							</table>
						</div>
					</fieldset>

					<fieldset class="hide-field">
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="30%" align="right"><spring:message code="org_name"/>角色：</td>
									<td><select id="leftRole" size="5" style="width: 150px;"></select>
									</td>
									<%if(((PmsUserVo)session.getAttribute(ConstantUtils.SESSION_USER)).getOrgId()==1){ %>
									<td><input type="button" value=">>" onclick="move('add2')" /><br />
										<input type="button" style="margin-bottom: 10px;"
										value="<<" onclick=" move('delete2')"/></td>
									<td><select id="rightRole" size="5" style="width: 150px;"></select>
									</td>
									<%} %>
								</tr>
							</table>
						</div>
					</fieldset>
					<input type="hidden" name="stime" value="<%=nonceObj[0]%>"/>
					<input type="hidden" name="sign" value="<%=nonceObj[1]%>"/>
				</form>
			</div>
			<div class="toolbar" style="text-align: center;">
				<a id="easyui-linkbutton" class="easyui-linkbutton"
					data-options="iconCls:'icon-ok'" href="javascript:void(0);"
					onclick="_submitFm()">保存</a> <a id="cancelButton"
					href="javascript:void(0);" data-options="iconCls:'icon-cancel'"
					class="easyui-linkbutton"
					onclick="javascript:parent.$('#dlg').dialog('close')">取消</a>
				<limits:uiAuth url="user_role.jsp">
					<a id="authorizeButton" href="javascript:void(0);"
						class="easyui-linkbutton" onclick="authorize()">成员授权</a>
				</limits:uiAuth>
			</div>
		</div>
		<!--主体 结束-->
	</div>
	<div id="dlg" class="easyui-dialog"
		style="width: 600px; height: 470px; padding-top: 0px;"
		data-options="title:'用户授权', iconCls:'icon-save',modal:true,closed:true,buttons:'#dlg_buttons'">
		<iframe scrolling="auto" frameborder="0"
			style="width: 100%; height: 99%;"></iframe>
	</div>
	<div id="model_list" class="easyui-dialog"
		style="width: 600px; height: 470px; padding-top: 0px;"
		data-options="title:'模型选择', iconCls:'icon-save',modal:true,closed:true,buttons:'#dlg_buttons'">
		<iframe scrolling="auto" frameborder="0"
			style="width: 100%; height: 99%;"></iframe>
	</div>
	<div id="zzgl" class="easyui-dialog"
		style="width: 950px; height: 600px; padding-top: 0px;"
		data-options="title:'组织管理', iconCls:'icon-save',modal:true,closed:true,buttons:'#dlg_buttons'">
		<iframe scrolling="auto" frameborder="0"
			style="width: 100%; height: 99%;"></iframe>
	</div>
	<div id="label" class="easyui-dialog"
		style="width: 800px; height: 500px; padding-top: 0px;"
		data-options="title:'标签选择', iconCls:'icon-save',modal:true,closed:true,buttons:'#dlg_buttons'">
		<iframe scrolling="auto" frameborder="0"
			style="width: 100%; height: 99%;"></iframe>
	</div>
	<div id="dlg_product" class="easyui-dialog"
		 style="width: 800px; height: 500px; padding-top: 0px;"
		 data-options="title:'产品管理', iconCls:'icon-save',modal:true,closed:true,buttons:'#dlg_buttons'">
		<iframe scrolling="auto" frameborder="0"
				style="width: 100%; height: 99%;"></iframe>
	</div>
	<script type="text/javascript">
		$('.hide-field').show();
		
	</script>
	<script type="text/javascript" src="../static/js/city/city.js"></script>
	<script type="text/javascript" src="../static/js/city/method01.js"></script>
</body>
</html>
